package com.niu.core.enums.poster;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.niu.core.common.utils.json.JsonModuleLoader;

import java.util.stream.Collectors;

public class PosterTypeEnum {

    public static JSONArray getType(String type){
        JSONArray posterType = JsonModuleLoader.build().mergeResultSet("poster/type.json");
        if (!type.isEmpty()) {
            return JSONUtil.parseArray(posterType.toList(JSONObject.class).stream().filter(i -> i.getStr("type").equals(type)));
        }
        return posterType;
    }
}
